package com.eastedu.report.common.model.parameter;

import com.eastedu.common.enums.DateCodeType;
import lombok.Builder;
import lombok.Getter;

import java.util.Objects;

/**
 * 通用参数
 *
 * @author superman
 */
@Getter
@Builder
public class GeneralParameter {
    private final DateCodeType codeType;
    private final Integer dateCode;
    private final String schoolName;
    private final String sectionName;

    /**
     * Gets code type.
     *
     * @return the code type
     */
    public DateCodeType getCodeType() {
        if (Objects.isNull(this.codeType)) {
            return DateCodeType.MONTH;
        }
        return codeType;
    }

    /**
     * Gets date code.
     *
     * @return the date code
     */
    public Integer getDateCode() {
        if (Objects.isNull(this.dateCode)) {
            return getCodeType().getLast();
        }
        return dateCode;
    }
}
